#import <Foundation/Foundation.h>
#import <objc/runtime.h>

#import "PITodoStatus.h"


NSString* const kPITaskOptionsViewStyle = @"viewStyle";
NSInteger const kPITaskOptionsViewStyleDefault = kPITaskViewStyleTimeAtEnd;


@implementation PITodoStatus


@synthesize toolbarOn, toggleOn, badgeValue, badgeOn, captionValue, itemsReturnedCount;
@synthesize itemsFilteredCount, itemsWithDetailsCount, autoContextAvailable, autoContextOn, showContexts, lowColour;
@synthesize fixedContextOn, autoContextPasteboardUpdateCount, showEmoji, showListDetails, shortDates, showIcons, singleLineOniPad;


// ******************************************************************************************
#pragma mark -
#pragma mark Initialisation and object management

- (id)init
{
    if ((self = [super init])) {
        self.toolbarOn = NO;
        self.badgeOn = NO;
        self.toggleOn = NO;
        
        self.itemsReturnedCount = 0;
        self.itemsFilteredCount = 0;
        self.itemsWithDetailsCount = 0;
        
        self.autoContextAvailable = NO;
        self.autoContextOn = NO;
        self.fixedContextOn = NO;
        self.autoContextPasteboardUpdateCount = -1;
        
        self.showListDetails = -1;
        self.showEmoji = YES;
        self.lowColour = YES;
        
        self.singleLineOniPad = NO;
        self.shortDates = -1;
        self.showIcons = YES;
    }
    
    return self;
}

- (void)dealloc
{
    [badgeValue release];
    [captionValue release];
    
    [super dealloc];
}


// ******************************************************************************************
#pragma mark -
#pragma mark Attribute access

- (void)setAutoContextOn:(BOOL)newAutoContext
{
    // If autocontext is changing then reset the update count so that next time we
    // build a query string we'll fetch the newest set of data
    if (newAutoContext != autoContextOn)
        self.autoContextPasteboardUpdateCount = -1;

    autoContextOn = newAutoContext;
}

@end
